<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<f:view xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:util="http://java.sun.com/jsf/composite/util">
	<ui:composition template="/views/layouts/main.xhtml">
	<ui:define name="content">
		<h:form id="formPrincipal">
			<div class="grid_18">
				<div class="grid_6">
					<util:home action="#{cenarioBaseBean.goHome}" />
					<p:commandButton value="#{i18n.btn_Novo}" action="#{cenarioBaseBean.goCreate}" 
						immediate="true" ajax="false" icon="ui-icon ui-icon-plus" />
				</div>
				<util:titulo value="#{i18n.CenarioBase_Titulo}" />
				<div class="grid_1">
					<util:help />
				</div>
			</div>
			
			<div class="grid_18">
				<p:messages closable="true" />
			</div>
			
			<div class="grid_18">
				<p:dataTable id="dataTableCenarioBase" widgetVar="dataTableCenarioBase"
					paginator="true" rows="#{contextoBean.dataTableRows}" dynamic="true" 
					selection="#{cenarioBaseBean.cenariosSelecionados}"
					value="#{cenarioBaseBean.cenarioBaseList}" lazy="true" var="var"
					currentPageReportTemplate="#{contextoBean.paginatorTemplate}"
					rowsPerPageTemplate="#{contextoBean.rowsPerPage}"
					paginatorPosition="#{contextoBean.paginatorPosition}"
					emptyMessage="#{i18n.NenhumClientePortalEncontrado}">
					<f:facet name="header">
						<div class="grid_7 tituloDataTable">
							<h:outputText value="#{i18n.CenarioBase_Grid_Header}" />
						</div>
						<div class="grid_7" style="text-align: right; float: right;">
							<p:commandButton type="button" onclick="dialogoFiltrarCenario.show()" 
								value="#{i18n.btn_Filtrar}" icon="ui-icon ui-icon-search" />
							<p:commandButton action="#{cenarioBaseBean.goDelete}" process=":formPrincipal:dataTableCenarioBase"
								onstart="spinner.show();" oncomplete="spinner.hide(); dialogoExcluir.show()" 
								value="#{i18n.btn_Excluir}" icon="ui-icon ui-icon-trash" update=":formExcluir"/>
						</div>
					</f:facet>
					<p:column headerText="#{i18n.CenarioBase_Grid_Nome}">  
			            <h:outputText value="#{var.nome}" />  
			        </p:column>
			        <p:column headerText="#{i18n.CenarioBase_Grid_Acoes}" style="width:40px;">
			        	<p:commandButton id="btnAcao" value="..." type="button" icon="ui-icon ui-icon-gear" style="float:right;" />
						<p:menu overlay="true" position="dynamic" trigger="btnAcao" my="left top" at="left bottom">
							<p:menuitem icon="ui-icon ui-icon-radio-off" value="#{i18n.btn_Detalhar}" 
								process="@this" update=":formVisualizarCenario" action="#{cenarioBaseBean.goVisualizar(var.id)}" 
								onstart="spinner.show();" oncomplete="spinner.hide();dialogoVisualizarCenario.show();"/>
							<p:menuitem icon="ui-icon ui-icon-pencil" value="#{i18n.btn_Editar}"
								process="@this" immediate="true" ajax="false" action="#{cenarioBaseBean.goEdit(var.id)}" />
						</p:menu>
			        </p:column>
			        <p:column selectionMode="multiple" style="width:18px;" />
				</p:dataTable>
			</div>
		</h:form>
		
		<ui:include src="/views/cenarioBase/_filtrar.xhtml" />
		<ui:include src="/views/cenarioBase/_visualizar.xhtml" />
		
		<util:dialogoSelecione />
		
		<p:dialog style="position:absolute" header="#{i18n.DialogoExcluir_Header}" widgetVar="dialogoExcluir" 
		width="450" modal="true" appendToBody="true" closable="true" resizable="false" >
		<h:form id="formExcluir">  
			<div class="dialog_container_16">
				<div class="dialog_grid_16 div-label" style="margin-top: 7px; margin-bottom: 7px;">
					<center><label class="label">#{cenarioBaseBean.msgExclusao}</label></center>
				</div>
				<div class="dialog_grid_16"><hr /></div>
				<div class="dialog_grid_16 right">
					<p:commandButton value="#{i18n.DialogoExcluir_Confirmar}" update=":formPrincipal"
						onstart="spinner.show();" oncomplete="spinner.hide();dialogoExcluir.hide();" 
						action="#{cenarioBaseBean.delete}" />
					<p:commandButton value="#{i18n.DialogoExcluir_Cancelar}" type="button" onclick="dialogoExcluir.hide();" />
				</div>
			</div>
		</h:form>
	</p:dialog>
	</ui:define>
	</ui:composition>
</f:view>